<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>

    // 定义函数
    function count(a,b,c){
        return a+b+c;
    }
    // 函数的使用
    var mn = count(10,20,"30");
    console.log(mn);

    var fnCount = function (a,b,c){
        return a+b+c;
    }

    // 函数定义第2种
    var useCount1 = fnCount(1,2,3);
    console.log(useCount);

    // 第3种，参数未定义，如何接收,无惨胜有参
    // 函数传递很多个参数
    var fnCountAll = function (){
       let sum ="";
        // arguments默认都是字符串接收 ["a","x","z","y","o"]
        // i下标
        for (let i in arguments){
            sum += arguments[i];
        }
        return sum;
    }
    var useCount3 = fnCountAll("a","x","z","y","o");
    console.log(useCount3);


   /*function add(a,b){
       return a + b;
   }


   var result = add(1,2);

   alert(result);*/

   // var add = function (a,b){
   //     return a + b;
   // }
   //
   // var result = add(1,2);
   //
   // var result1 = add(1,2,3);
   // // alert(result1)
   //
   // var result2 = add(1);
   // alert(result2);

   //alert(result);

</script>
</body>
</html>